package com.marry.business.repository.user;

import com.marry.contract.domain.Menu;
import com.marry.contract.vo.MenuVo;
import org.springframework.data.r2dbc.repository.Query;
import org.springframework.data.r2dbc.repository.R2dbcRepository;
import reactor.core.publisher.Flux;

/**
 * @path：com.marry.mapper.MenuMapper.java
 * @className：MenuMapper.java
 * @description：菜单
 * @author：杨超
 * @dateTime：2020/11/19 15:09
 * @editNote：
 */
public interface MenuRepository extends R2dbcRepository<Menu, String> {

    @Query("select m.id,m.code,m.p_code,m.p_id,m.name,m.url,m.is_menu,m.level,m.sort,m.status,m.icon,m.create_time,m.update_time\n" +
            "        from sys_menu m\n" +
            "        inner join sys_privilege p on m.id = p.menu_id\n" +
            "        where p.role_id = :roleId")
    Flux<MenuVo> getMenuByRoleId(String roleId);

}
